<template>
	<view>
		<view style='width: 100%;height: 180rpx;'>
			<uni-ec-canvas class="uni-ec-canvas" id="line-chart" ref="canvas" canvas-id="lazy-load-chart" :ec="ec"></uni-ec-canvas>
		</view>
	</view>
</template>
<script>
	// import uniEcCanvas from '../../uni-ec-canvas/uni-ec-canvas.vue'
	import  uniEcCanvas from "../uni-ec-canvas/uni-ec-canvas.vue"
	import * as echarts from "../uni-ec-canvas/echarts.js"
	// import * as echarts from '../../uni-ec-canvas/echarts'
	export default {
		components: {
			uniEcCanvas
		},
		props:["Elist"],
		data() {
			return {
				list:[1,3,5,7],
				time:"",
				a:"",
				is:false,
				ec: {
					lazyLoad: true,
					option: {
						color: ['#3398DB'],
						tooltip: {
							trigger: 'axis'
						},
						toolbox: {
							show: true
						},
						grid: {
							top: 0,
							left: 0,
							right: 0,

							bottom: 0,
							width: 'auto',
							height: 'auto',
							containLabel: true

						},
						xAxis: {

							data: ['4时', '8时', '12时', '16时', '20时', "24时"],
							"axisTick": {
								"show": false,
								// width:"3",
							},

							axisLabel: {
								// formatter: '{value}',
								textStyle: {
									color: '#666666', //坐标值得具体的颜色
								}
							},
							axisLine: {
								position: "top",
								lineStyle: {
									color: "#ddddd",
									width: "2",
									// shadowBlur:2,
									// shadowColor: '3f6eff',

								}
							}

						},
						yAxis: {
							"axisLine": { //y轴
								"show": false
							},
							type: 'value',
							splitNumber: 4,
							axisLabel: {
								formatter: ''
							},
							min: "8",
							"axisTick": { //y轴刻度线
								"show": false,
								onZero: true,
								width: 10,
								lineStyle: {
									width: 10,
									type: "dashed"
								}
							},
							"splitLine": { //网格线
								"show": true,
								lineStyle: {
									type: "dashed"

								}
							}
						},
						series: [{
							name: '最低',
							type: 'line',
							data: [1, 2, 3, 4, 6, 8],
							symbol: 'circle',

							lineStyle: {
								color: "#333366"
							},
							itemStyle: {
								normal: {
									color: '#333366'
								}
							},
						}]
					}
				}
			}
		},
		created() {
			 // console.log("子组件新加载")
			 
			this.guazai()
		},
		computed:{
			// Ealist:function(){
			// 	return 	this.Elist
			// }
			// Ealist(){
			// 	return this.List
			// }
		},
		  watch: {
		 Elist: function(newV, oldV) {
		     this.list= newV;
		     }
		  },
		mounted() {
		},
		methods:{
			guazai(){
				var that=this
				 wx.getStorage({
				   key: 'time',
				   success (res) {
				     console.log(res.data)
					 
					setTimeout(() => {
						// console.log(this.$refs)
						that.$refs['canvas'].init()
						// console.log("计算属性")
						// console.log(this.list)
						// that.list=that.Eacharslist
						that.ec.option.xAxis.data=res.data
						that.ec.option.series[0].data = that.list
						
					}, 1000)
				
				   }
				 })
			},
			upEar(){
				var that=this
				wx.getStorage({
				  key: 'time',
				  success (res) {
					  	that.ec.option.xAxis.data=res.data
					  	that.ec.option.series[0].data = that.list
				  },
				  fail(){
					  console.log("获取店铺id失败");
				  }
				})
				
			}
		},
		updated() {
			var that=this
			that.upEar()
		}
		}
</script>
